package com.db.williamchart;

import com.db.williamchart.extensions.Pair;

import com.db.williamchart.data.configuration.ChartConfiguration;
import com.db.williamchart.animation.ChartAnimation;
import com.db.williamchart.data.DataPoint;
import com.db.williamchart.data.configuration.DonutChartConfiguration;
import com.db.williamchart.data.DonutDataPoint;
import com.db.williamchart.data.Frame;
import com.db.williamchart.data.Label;

import java.util.List;

import kotlin.Triple;

public interface ChartContract {

    interface AxisView {
        void postInvalidate();

        void drawLabels(List<Label> xLabels);

        void drawGrid(
                Frame innerFrame,
                List<Float> xLabelsPositions,
                List<Float> yLabelsPositions
        );

        void drawDebugFrame(List<Frame> frames);
    }

    interface LineView extends AxisView {
        void drawLine(List<DataPoint> points);

        void drawLineBackground(Frame innerFrame, List<DataPoint> points);

        void drawPoints(List<DataPoint> points);
    }

    interface BarView extends AxisView {
        void drawBars(List<Frame> frames);

        void drawBarsBackground(List<Frame> frames);
    }

    interface DonutView {
        void postInvalidate();

        void drawArc(List<Float> degrees, Frame innerFrame);

        void drawBackground(Frame innerFrame);

        void drawDebugFrame(Frame innerFrame);
    }

    interface Renderer {
        boolean preDraw(ChartConfiguration configuration) throws IllegalAccessException;

        void draw();

        void render(List<Pair<String, Float>> entries);

        void anim(List<Pair<String, Float>> entries, ChartAnimation<DataPoint> animation);

        Triple<Integer, Float, Float> processClick(Float x, Float y);

        Triple<Integer, Float, Float> processTouch(Float x, Float y);
    }

    interface DonutRenderer {
        boolean preDraw(DonutChartConfiguration configuration) throws IllegalAccessException;

        void draw();

        void render(List<Float> values);

        void anim(List<Float> values, ChartAnimation<DonutDataPoint> animation);
    }
}
